package com;

import org.springframework.util.Assert;

import java.util.Map;

public class ReportThread implements Runnable {
    private volatile Boolean exit = false;

    private final Map<String, Object> params;

    public ReportThread(Map<String, Object> params) {
        this.params = params;
        params.put("exit", exit);
    }

    public boolean isExit() {
        return exit;
    }

    public void setExit(boolean exit) {
        this.exit = exit;
        params.put("exit", exit);
    }

    @Override
    public void run() {
        while (true) {
            System.out.println(params.get("exit"));
            try {
                Thread.sleep(500);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
